/*
 * @Author: ZhangXiaodong
 * @Date: 2025-04-12 10:18:10
 * @LastEditors: ZhangXiaodong
 * @LastEditTime: 2025-04-25 23:24:53
 * @Description: user 路由
 * @FilePath: /blog-ost/src/routers/user/index.js
 */
const userCtrl = require('../../controller/user')
const { SuccessModel, ErrorModel } = require('../../model/ResModel')


const routerUser = (req)=>{
    const { path, method } = req;
    // 登陆
    if (method === "POST" && path == "/api/user/login") {
      return userCtrl.login(req.body).then(data=>{
        if(data){
          return new SuccessModel(data,'登陆成功')
        }
        return new ErrorModel('用户名密码错误')

      })
    }


}

module.exports = routerUser